/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package processer;

import log.LogDef;
import main.BotManager;
import main.Constants;
import utils.Debug;

/**
 *
 * @author Administrator
 */
public class GameChooser extends Processer {

    public GameChooser(RoBot parent, GameData gameData, BotManager manager) {
        super(parent, gameData, manager);
        Debug.d("new game chooser");
        int r = utils.Utils.nextInt(6);
        switch (r % 10) {
            case 0:
                gameData.gameTypePlay = Constants.BA_CAY;
                break;
            case 1:
                gameData.gameTypePlay = Constants.TIEN_LEN;
                break;
            default:
                gameData.gameTypePlay = Constants.PHOM;
                break;
        }
        parent.request.chosseGame(gameData.gameTypePlay);
        gameData.setGameTypePlay(gameData.gameTypePlay);
    }

    @Override
    public void processMesage(String[] part) {
        Debug.d("processer game choose :" + part[0]);
        super.processMesage(part);
        if (part[0].equals("GA")) {
            gameData.setGaData(part);
            manager.logUserStatus(gameData.myName + ",number online :" + gameData.getNumberOnline(), LogDef.LOG_LEVEL.LOG_INFO);
            parent.changeProcesser(RoBot.ROOM_CHOOSER);
            return;
        }
    }

    @Override
    public void doLoop() {
    }
}
